<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<title>使用图像演示文档</title>
<body onload="setImage()">
<canvas id="myCanvas" width="300" height="200" style="border:1px solid
black">
</canvas>
<script>
    function setImage(){
        const c = document.getElementById("myCanvas");
        const ctx = c.getContext("2d");
        const img = new Image();
        img.src="../image/logo.gif";
        img.onload = function() {
            ctx.drawImage(img,10,10,50,50);
        }
    }
</script>
</body>
</html>